# Makefile for YANG Converter Application
#  
#   yangdump application directory
#
# Convert a YANG module to different formats such as XSD

############### SOURCE PROFILE ##############################

SUBDIR_NM=yangdump
SUBDIR_CPP=-I../ydump

############### TARGET PROFILE ##############################

TARGET=$(TBASE)/$(SUBDIR_NM)

BIN_INST=$(TBASE)/bin
REAL_INST=$(DESTDIR)$(PREFIX)/bin

##################### LIBRARIES ########################

# The order of these LIBS matters!
#
# If the linker can't find external symbols you know should
# be there and you get an Unresolved External error 
#   file foo : unresolved external to bar
# Then put the library that contains 'foo' BEFORE the one
# that contains 'bar'. 


LIBS = -lydump -lncx -lxml2 -lz -lm

LIBTARGS= $(LBASE)/libncx.$(LIBNCXSUFFIX) $(LBASE)/libydump.a

############################# MAKE RULES ##################
ifdef DEVELOPER
all:
else
all: yangdump
endif  # DEVELOPER

#################### PLATFORM DEFINITIONS ############
include ../platform/platform.profile

################ DEPENDENCIES #########################
# depend rule must be included after the 'all' make rule

include ../platform/platform.profile.depend

test:


# needs to be done by root
install:
ifndef DEVELOPER
	mkdir -p $(REAL_INST)
	install $(OWNER) $(GRP) $(BIN_INST)/$(SUBDIR_NM) $(REAL_INST)
endif

uninstall:
	rm -f  $(REAL_INST)/$(SUBDIR_NM)

yangdump: $(OBJS) $(LIBTARGS)
	$(LINK) $(CFLAGS) $(LFLAGS) $(OBJS) -o $(BIN_INST)/$(SUBDIR_NM) $(LPATH) $(FPATH) $(LIBS)

clean:
	rm -f $(OBJS) $(BIN_INST)/$(SUBDIR_NM)

superclean:
	rm -f *~  $(DEPS) dependencies $(OBJS) $(BIN_INST)/$(SUBDIR_NM)

distclean: superclean

.PHONY: yangdump

# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:

include ./dependencies
